Implement BoundedEncodedLength trait and implementations on primitives#267
Implement BoundedEncodedLength trait and implementations on primitives#267coriolinus wants to merge 9 commits intomasterfrom
BoundedEncodedLength trait and implementations on primitives#267Conversation
| /// can be implemented accurately. Other containers, such as `StorageMap`, do not have enforced size | ||
| /// limits. For those containers, it is necessary to make a documented assumption about the maximum | ||
| /// usage, and compute the max encoded length based on that assumption. | ||
| pub trait BoundedEncodedLen: Encode { |
There was a problem hiding this comment.
I still don't see why this should be implemented in scale. This is Substrate specific and not SCALE specific.
There was a problem hiding this comment.
The short answer is that Encode::size_hint is toothless: it's a 'best-effort' thing with a useless default implementation. Still, we do have the need sometimes for a more realistic size hint, and that need is generalizable to all of SCALE, not just Substrate.
There was a problem hiding this comment.
This is also "toothless" as what is the maximum size of a vec?
As already said in element, I don't see this in SCALE.
There was a problem hiding this comment.
Not implemented for Vec 😁. I'll move this work to the substrate repo instead though.
|
Transferred to paritytech/substrate#8720. |
No description provided.